//
//  HttpTool.swift
//  swift_learning
//
//  Created by aron on 2017/1/15.
//  Copyright © 2017年 arons. All rights reserved.
//

import UIKit

class HttpTool: NSObject {
    
    var resultCallback: ((_ resultJson: String)->())?;

    // 闭包类型(参数)->(返回值)
    func loadData(callBack: @escaping (_ resultJson: String)->()) -> Void {
        // swift3的GCD写法
        DispatchQueue.global().async {
            DispatchQueue.main.async {
                callBack("{\"name\": \"xiaoming\"}");
            }
        }
    }
    
    // 闭包类型(参数)->(返回值)
func loadData2(callBack: @escaping (_ resultJson: String)->()) -> Void {
    // swift3的GCD写法
    self.resultCallback = callBack;
    DispatchQueue.global().async {
        DispatchQueue.main.async {
            callBack("{\"name\": \"xiaoming\"}");
        }
    }
}
    
    
    deinit {
        print("=== httptool deinit ====");
    }
}
